# php-personal

#### Guide for ubuntu 22.04 (commin soon)

## PHP Backend API Rest CRUD like emacs-personal for emacsens

## Requeriments

- php
- php-pdo
- mariadb-server
- mariadb-client

#### and maybe you prefer enable 'errors' for development time

- Put `display_errors = On` on file `/etc/php/php.ini`

## Install a mysql db on your system

* You need be root becose with doas or sudo not works the mariadb installation.
* Note: `user` and `libre` will be replace by your user and group case
  in your machine.
    - `apt install mariadb-server mariadb-client`
    - `mv /var/lib/mysql ~`
    - `mkdir -p /var/lib/mysql`
    - `chown user:libre /var/lib/mysql`
    - `mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql`
    - `service mariadb start`
    - `mysqladmin -u root password 1234`
    - `exit`

# For the next steps you dont need be root

## Create a database

- `mysql -uroot -p` (1234)
- `create database php_personal;`
- `quit`

* for this example i use a database name but you can change if prefer
  but too indicate on `index.php`

# Finally clone and run

- `git clone https://notabug.org/saravia/php-personal.git`
- `php -S localhost:8080 -t php-personal`

## Scalable modules modes

### Mode force scalabe every run

- This mode force reinstall the hidden querys on all modules, removing
  and install again, is for development mode tables edition.

### Mode install and use only

- Too you can run one time with the exec uncomment and after finish
  run and install all the modules, you can comment the exec line for
  use only.

### TODO

- [] Duplicate users.
- [] Rol superuser needed for update rols.
- [*] Environment variables for install `EV_php_name` [Environment php](https://www.php.net/manual/en/reserved.variables.environment.php).
- [] Temporally hash for be optional.
- [] One client at time for be optional.
- [] Restclient API test simulation for get a true when an endpoint works fine.
- [] Remove class and put only functions